<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//用户信息
Route::get('/user', function (Request $request) {
    return $request->user();
});

//初始化
Route::get('/init', 'Init\IndexController@index');

//群发消息列表
Route::get('/messages/groups', 'Resources\MessagesController@groups');

//资源路由
const RESOURCES1 = [
    'customers' => 'Customer',
    'messages' => 'Messages',
    'acceptRecords' => 'AcceptRecord',
    'tags' => 'Tag',
];
foreach (RESOURCES1 as $k => $item) {
    $controller_name = 'Resources\\' .$item . 'Controller';
    Route::resource(
        $k,
        $controller_name,
        ['except' => ['create', 'edit'],]
    );
}

//误认领
Route::post('/service/request_accept_cus', 'ApiController@mistakenAccept');

// 修改密码
Route::post('/auth/password/modify', 'Auth\PasswordController@changePassword');
